.text

.extern kernel64_main
.extern vsprintf
.extern strlen
.extern console_write
.extern printk_buff

.globl _start
.type _start, @function
_start:
    call kernel64_main
    jmp .

.globl printk
.type printk, @function
printk:
    pushq %rdi
    pushq %r9
    pushq %r8
    pushq %rcx
    pushq %rdx
    pushq %rsi

    movq %rdi, %rsi
    movq printk_buff, %rdi
    movq %rsp, %rdx
    call vsprintf

    movq printk_buff, %rdi
    call strlen

    movq printk_buff, %rdi
    movq %rax, %rsi
    call console_write

    addq $(8 * 6), %rsp
    ret